package com.devunion.salon.client.rpc;

import com.devunion.salon.client.app.bean.DepartmentModel;
import com.devunion.salon.client.util.RequestUtil;
import com.extjs.gxt.ui.client.data.ListLoadConfig;
import com.extjs.gxt.ui.client.data.ListLoadResult;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.RemoteService;
import com.google.gwt.user.client.rpc.ServiceDefTarget;

/**
 * @author spetrakovsky
 */
public interface DepartmentService extends RemoteService {

    public static class App {
        private static DepartmentServiceAsync async;

        public static DepartmentServiceAsync getInstance() {
            if (async == null) {
                async = (DepartmentServiceAsync) GWT.create(DepartmentService.class);
                ((ServiceDefTarget) async).setServiceEntryPoint(RequestUtil.getContextPath() +
                        "DepartmentService.page");
            }
            return async;
        }
    }

    ListLoadResult<DepartmentModel> getDepartments(ListLoadConfig config);
}
